#ifndef __KEYDEF_H__
#define __KEYDEF_H__

#ifndef ENUM_DUMMY4WORD
/**
    Macro to generate dummy element for enum type to expand enum size to word (4 bytes)
*/
//@{
#define ENUM_DUMMY4WORD(name)   E_##name = 0x10000000
//@}
#endif

////////////////////////////////////////////////////////////////////////////////
//GxInput                   Get Key
//Key Driver                Detect Key change

//-----------------------------------------------------------------------------
// KeyScan global definitions
//-----------------------------------------------------------------------------
// Flag pattern
// Key pressed
#define FLGKEY_UP                       0x00000001      // Key UP pressed
#define FLGKEY_DOWN                     0x00000002      // Key DOWN pressed
#define FLGKEY_LEFT                     0x00000004      // Key LEFT pressed
#define FLGKEY_RIGHT                    0x00000008      // Key RIGHT pressed

#define FLGKEY_ENTER                    0x00000010      // Key ENTER (SET) pressed
#define FLGKEY_MENU                     0x00000020      // Key MENU pressed
#define FLGKEY_BACK                      0x00000040     // Key Back pressed
#define FLGKEY_MODE                     0x00000080      // Key MODE pressed

//special normal key
#define FLGKEY_KEY_POWER                0x80000000

#define FLGKEY_KEY_MASK                 0xFFFFFFFF      // Key flag mask

#define FLGKEY_KEY_MASK_DEFAULT         FLGKEY_KEY_MASK // Default key mask
#define FLGKEY_KEY_MASK_NULL            0x00000000

#define FLGKEY_KEY_REL_MASK_DEFAULT     FLGKEY_KEY_MASK      // Default key released mask
#define FLGKEY_KEY_CONT_MASK_DEFAULT    FLGKEY_KEY_MASK      // Default key continue mask
#define FLGKEY_KEY_UDLR                 FLGKEY_UP|FLGKEY_DOWN|FLGKEY_RIGHT|FLGKEY_LEFT
#define FLGKEY_KEY_OFFALL               0x00000000
#define FLGKEY_KEY_CONT_OFFALL          0x00000000
#define FLGKEY_KEY_CONT_MASK_OFFALL     0x00000000
#define FLGKEY_KEY_SOUND_MASK_DEFAULT   FLGKEY_KEY_MASK

/**
    Key status for normal key.
*/
typedef enum _KEY_STATUS {
	KEY_RELEASE,        ///< The key is from active to inactive.
	KEY_PRESS,          ///< The key is from inactive to active.
	KEY_CONTINUE,       ///< The key is still being pressed.
	ENUM_DUMMY4WORD(KEY_STATUS)
} KEY_STATUS;


#endif /* __KEYDEF_H__ */
